package com.yanqu.road.dataHelper.del.mgr;

import com.yanqu.road.dataHelper.DelScript;
import com.yanqu.road.dataHelper.del.mgr.task.CrossDelTask;
import com.yanqu.road.dataHelper.manager.BaseMgr;

import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

public class TimerDelMgr extends BaseMgr {
    private static ScheduledExecutorService timerExecutorService;

    private static CrossDelTask crossDelTask;

    public static synchronized boolean initGlobalTimers() {
        timerExecutorService = DelScript.getTimerExecutorService();

        // 检查玩家心跳
        int interval = 5;
        if (null == crossDelTask) {
            crossDelTask = new CrossDelTask();
            timerExecutorService.scheduleWithFixedDelay(crossDelTask, interval, interval, TimeUnit.SECONDS);
        }

        return true;
    }
}
